<?php

namespace App\Listeners\Plane\PlaneOrder;

use App\Events\Plane\PlaneOrder\PlaneOrderTicketFailedEvent;
use App\Models\Plane\PlaneOrders\Repositories\Interfaces\PlaneOrderRepositoryInterface;

class PlaneOrderTicketFailedListener
{
    /**
     * Create the event listener.
     *
     * @return void
     */
    public function __construct()
    {
        //
    }

    /**
     * Handle the event.
     *
     * @param object $event
     * @return void
     */
    public function handle(PlaneOrderTicketFailedEvent $event)
    {
        $order_info     = $event->order;
        $planeOrderRepo = app(PlaneOrderRepositoryInterface::class);
        $planeOrderRepo->ticketFailedAndRefund($order_info, $event->passengers);
    }
}
